home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9390 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  52 lines

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Why doesn┤t work _fmemcpy > 64kB
  5. Date: Fri, 01 Mar 1996 16:24:51 +0200
  6. Organization: Carelcomp Forest
  7. Message-ID: <313708B3.289B@cmt.lpr.mail.carel.fi>
  8. References: <4h45r7$apq@aix11.hrz.uni-oldenburg.de>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Andreas Weichert wrote:
  16. > How can I copy data >64kB with Borland C++ 4.0.
  17. > _fmemcopy works only up to the 3615. Element.
  18. > int main(void)
  19. > {
  20. > long i;
  21. > const long Size=20000;
  22. > float huge *p1;
  23. > float huge *p2;
  24. > p1=(float* huge)farcalloc(Size,sizeof(float));
  25. > for(i=0;i<Size;i++)    p1[i]=1;
  26. > p2=(float* huge)farcalloc(Size,sizeof(float));
  27. > for(i=0;i<Size;i++)    p2[i]=2;
  28. > _fmemcpy((void* huge) p2,(void* huge) p1,Size*sizeof(float));
  29. > cout<<p2[Size-1];    // -> 1
  30. > cout<<endl;
  31. > for(i=0;i<Size;i++)
  32. >     if(p2[i]!=1) {cout<<i; break; }   // ->3616
  33. > return(0);
  34. > }
  35.  
  36. The element number seems to be calculated like this (4 = sizeof(float)):
  37.  
  38.     elem = 20000 * 4 - 65536 / 4
  39.  
  40. Are you sure the size parameter of fmemcpy is 32 bits wide? size_t in 16 bit 
  41. environments tends to be only 16 bits, ie. max 65535. Anything above will wrap 
  42. around.
  43.  
  44. Later,
  45.  AriL
  46. -- 
  47. All my opinions are mine and mine alone.
  48.